package com.zy.struts.domain;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class DomainTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Configuration cfg=new Configuration().configure();
		SessionFactory sf=cfg.buildSessionFactory();
		Session session=sf.openSession();
		Transaction tx=session.beginTransaction();
		User user=new User();

		user.setName("yang");
		user.setPassword("111");
		session.save(user);
		tx.commit();
		session.close();
	}

}
